**************************************
*** Compensation vs. Protectionism *** 
**************************************

use "kimpelc_ad_taa.dta", clear

bysort cty_fips: egen ad_total = total(sum_ad_pc)

* Table A3: Trade Protection and Trade Compensation (Controlling for Industrial Composition)

eststo clear 
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag1 cty_emp*_share i.year, fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag3 cty_emp*_share i.year, fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag5 cty_emp*_share i.year, fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag1 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   cty_emp*_share i.year, fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag3 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   cty_emp*_share i.year, fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag5 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   cty_emp*_share i.year, fe
  
esttab using "TableA3.tex", label  keep(d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag1 all_petitions_wrks_pc_lag3 all_petitions_wrks_pc_lag5 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc   ) indicate("Year FE = *2000*") se(5) b(5) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars r2

* Table A4: Certified vs. Rejected (Controlling for Industrial Composition)

eststo clear
eststo: xtreg sum_ad_pc d_impusch_p9  d_czone_USexport certified_petitions_wrks_pc_lag1  rejected_petitions_wrks_pc_lag1 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   cty_emp*_share i.year, fe
eststo: xtreg sum_ad_pc d_impusch_p9  d_czone_USexport certified_petitions_wrks_pc_lag3  rejected_petitions_wrks_pc_lag3 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   cty_emp*_share i.year, fe
eststo: xtreg sum_ad_pc d_impusch_p9  d_czone_USexport certified_petitions_wrks_pc_lag5  rejected_petitions_wrks_pc_lag5 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   cty_emp*_share i.year, fe

esttab using "TableA4.tex", label  keep(d_impusch_p9 d_czone_USexport certified_petitions_wrks_pc_lag1 certified_petitions_wrks_pc_lag3 certified_petitions_wrks_pc_lag5 rejected_petitions_wrks_pc_lag1 rejected_petitions_wrks_pc_lag3 rejected_petitions_wrks_pc_lag5  rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc) order(d_impusch_p9 d_czone_USexport  certified_petitions_wrks_pc_lag1 rejected_petitions_wrks_pc_lag1 certified_petitions_wrks_pc_lag3 rejected_petitions_wrks_pc_lag3 certified_petitions_wrks_pc_lag5   rejected_petitions_wrks_pc_lag5  rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc) indicate("Year FE = *2000*") se(5) b(5) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars r2

* Table A5: Trade Protection and Trade Compensation (Excluding Counties with no AD Petitions)

eststo clear 
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag1 i.year if ad_total != 0, fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag3 i.year if ad_total != 0, fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag5 i.year if ad_total != 0, fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag1 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9  i.year  if ad_total != 0, fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag3 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9  i.year  if ad_total != 0, fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag5 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9  i.year  if ad_total != 0, fe

esttab using "TableA5.tex", label  keep(d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag1 all_petitions_wrks_pc_lag3 all_petitions_wrks_pc_lag5 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc   ) indicate("Year FE = *2000*") se(5) b(5) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars r2

* Table A6: Certified vs. Rejected (Excluding Counties with no AD Petitions)
 
eststo clear
eststo: xtreg sum_ad_pc d_impusch_p9  d_czone_USexport certified_petitions_wrks_pc_lag1  rejected_petitions_wrks_pc_lag1 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9  i.year  if ad_total != 0, fe
eststo: xtreg sum_ad_pc d_impusch_p9  d_czone_USexport certified_petitions_wrks_pc_lag3  rejected_petitions_wrks_pc_lag3 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9  i.year  if ad_total != 0, fe
eststo: xtreg sum_ad_pc d_impusch_p9  d_czone_USexport certified_petitions_wrks_pc_lag5  rejected_petitions_wrks_pc_lag5 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9  i.year  if ad_total != 0, fe

esttab using "TableA6.tex", label  keep(d_impusch_p9 d_czone_USexport certified_petitions_wrks_pc_lag1 certified_petitions_wrks_pc_lag3 certified_petitions_wrks_pc_lag5 rejected_petitions_wrks_pc_lag1 rejected_petitions_wrks_pc_lag3 rejected_petitions_wrks_pc_lag5  rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc) order(d_impusch_p9 d_czone_USexport  certified_petitions_wrks_pc_lag1 rejected_petitions_wrks_pc_lag1 certified_petitions_wrks_pc_lag3 rejected_petitions_wrks_pc_lag3 certified_petitions_wrks_pc_lag5   rejected_petitions_wrks_pc_lag5  rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc) indicate("Year FE = *2000*") se(5) b(5) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars r2

* Table A7: Steel Sector (Excluding Counties with no AD Petitions)

eststo clear
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L1st_all_petitions_wrks_cty_pc i.year if ad_total != 0, fe
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L3st_all_petitions_wrks_cty_pc i.year if ad_total != 0, fe
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L5st_all_petitions_wrks_cty_pc i.year if ad_total != 0, fe
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L1st_all_petitions_wrks_cty_pc rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year if ad_total != 0, fe
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L3st_all_petitions_wrks_cty_pc rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year if ad_total != 0 , fe
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L5st_all_petitions_wrks_cty_pc rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year if ad_total != 0, fe

esttab using "TableA7.tex", label  keep(d_impusch_p9 d_czone_USexport L1st_all_petitions_wrks_cty_pc L3st_all_petitions_wrks_cty_pc L5st_all_petitions_wrks_cty_pc rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc   ) indicate("Year FE = *2000*") se(5) b(5) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars r2

*************************
*** Electoral Effects *** 
*************************

use "kimpelc_ad_taa_election.dta", clear

* Table A8: Effect on Incumbent Share in Counties with Additional Control

eststo clear	
eststo: xtreg incumbent_share d_impusch_p9 all_taa_wrks_t4_lag_pc dem_legislator i.year if incumbent_party_d==1, fe
eststo: xtreg incumbent_share d_impusch_p9 certified_taa_wrks_t4_lag_pc rejected_taa_wkrs_t4_lag_pc dem_legislator i.year if incumbent_party_d==1, fe
eststo: xtreg incumbent_share d_impusch_p9 all_taa_wrks_t4_lag_pc dem_legislator i.year if incumbent_party_d==0, fe
eststo: xtreg incumbent_share d_impusch_p9 certified_taa_wrks_t4_lag_pc rejected_taa_wkrs_t4_lag_pc dem_legislator i.year if incumbent_party_d==0, fe

esttab using "TableA8.tex",  label  keep(d_impusch_p9 all_taa_wrks_t4_lag_pc certified_taa_wrks_t4_lag_pc rejected_taa_wkrs_t4_lag_pc dem_legislator) order(d_impusch_p9 all_taa_wrks_t4_lag_pc certified_taa_wrks_t4_lag_pc rejected_taa_wkrs_t4_lag_pc dem_legislator) se(3) b(3) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars r2 indicate("Year FE = *20*")
